import service from '@/utils/request'

// @Summary 用户登录
// @Produce  application/json
// @Param data body {username:"string",password:"string"}
// @Router /base/login [post]
export const login = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/login',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

// @Summary 用户登出
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登出成功"}"
// @Router /base/logout [post]
export const logout = (data) => {
  return service({
    url: '/base/logout',
    method: 'post',
    data: data
  })
}

export const getTemplateList = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/tmp/list',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addTemplate = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/tmp/add',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const editTemplate = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/tmp/edit',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const delTemplate = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/tmp/del',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getAgentList = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/agent/list',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addAgent = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/agent/add',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const editAgent = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/agent/edit',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const delAgent = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/agent/del',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getMemberList = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/member/list',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getCustomList = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/custom/list',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getCompanyList = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/company/list',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getAllCustomList = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/sync/data/custom-list',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const syncAllMember = (params) => { 
  return new Promise((resolve,reject)=>{
    service.post('/boss/sync/member/all',params)
    .then(res=>{
      resolve(res.data) 
    })
  })
}


